class EventScheduleData {
  late String id;
  late String eventName;
  late String unitName;
  late String status;
  late String statusName;
  late String code;
  late String venueName; // 场馆名
  late String date;
  late String time;
  late String week;
  late bool subscribed; // 是否关注
  late String cover;
  late String background;
  late String scheduleName;
  late String disciplineName;
  late int videoType; // 0 无关联 1直播 2点播
  late String startDate;
  String? locationName;

  EventScheduleData(Map<String, dynamic> json) {
    id = "${json["id"]}";
    eventName = "${json["event_name"]}";
    unitName = "${json["unit_name"]}";
    status = "${json["status"]}";
    statusName = "${json["status_name"]}";
    code = "${json["code"]}";
    venueName = "${json["venue_name"]}";
    date = "${json["date"]}";
    time = "${json["time"]}";
    week = "${json["week"]}";
    locationName = json['location_name'] as String?;

    try {
      subscribed = json["subscribed"] as bool;
    } catch (e) {
      subscribed = false;
    }

    cover = "${json["cover"]}";
    background = "${json["background"]}";
    scheduleName = "${json["schedule_name"]}";
    disciplineName = "${json["discipline_name"]}";

    try {
      videoType = json["game_video_type"] as int;
    } catch (e) {
      videoType = 0;
    }
    startDate = "${json["start_date"]}";
  }

  Map<String, dynamic> get json {
    return Map<String, dynamic>()
      ..["id"] = id
      ..["event_name"] = eventName
      ..["unit_name"] = unitName
      ..["status"] = status
      ..["status_name"] = statusName
      ..["code"] = code
      ..["venue_name"] = venueName
      ..["date"] = date
      ..["time"] = time
      ..["week"] = week
      ..["subscribed"] = subscribed
      ..["cover"] = cover
      ..["background"] = background
      ..["schedule_name"] = scheduleName
      ..["discipline_name"] = disciplineName
      ..["game_video_type"] = videoType
      ..["start_date"] = startDate
      ..['location_name'] = locationName;
  }
}

// "id": 1,
// "event_name": "男子反曲弓个人",
// "unit_name": "1/4淘汰赛",
// "status": "SCHEDULED",
// "status_name": "按日程计划",
// "code": "V28", // 场馆代码
// "venue_name": "成都现代五项赛事中心马术体育场", // 场馆名
// "date": "2021-08-22",
// "time": "17:40",
// "week": "星期日",
// "subscribed": false // 是否关注

// GameDetail(Map<String, dynamic> json) {
//   id = "${json["id"]}";
//   discipline_name = "${json["discipline_name"]}";
//   discipline = "${json["discipline"]}";
//   detail = "${json["detail"]}";
//   title = "${json["title"]}";
//   cover = "${json["cover"]}";
//   background = "${json["background"]}";
// }
//
// Map<String, dynamic> get json {
//   return Map<String, dynamic>()
//     ..["id"] = id
//     ..["discipline_name"] = discipline_name
//     ..["discipline"] = discipline
//     ..["detail"] = detail
//     ..["title"] = title
//     ..["cover"] = cover
//     ..["background"] = background;
// }
